﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DbGenerator.Model.attributes.root;
using DbGenerator.Model.units.constraint.root;

namespace DbGenerator.Model.attributes.types
{
    [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
    public class TFKAttribute : TConstraintAttributeBase
    {
        #region ctors
        public TFKAttribute(string referencedSchemaName, string rawReferencedTableName, string referencedColumnName
            , EFKRule updateRule
            , EFKRule deleteRule)
        {
            _ReferencedSchemaName = referencedSchemaName;
            _ReferencedTableName = rawReferencedTableName;
            _ReferencedColumnName = referencedColumnName;
            _UpdateRule = updateRule;
            _DeleteRule = deleteRule;
        }
        public TFKAttribute(string referencedSchemaName, string rawReferencedTableName, string referencedColumnName)
            : this(referencedSchemaName, rawReferencedTableName, referencedColumnName, EFKRule.NOACTION, EFKRule.NOACTION)
        {
        }
        #endregion

        #region properties

        private EFKRule _UpdateRule;
        public EFKRule UpdateRule
        {
            get { return _UpdateRule; }
        }

        private EFKRule _DeleteRule;
        public EFKRule DeleteRule
        {
            get { return _DeleteRule; }
        }
        private string _ReferencedTableName;
        public string ReferencedTableName
        {
            get { return _ReferencedTableName; }
        }
        private string _ReferencedSchemaName;
        public string ReferencedSchemaName
        {
            get { return _ReferencedSchemaName; }
        }
        private string _ReferencedColumnName;
        public string ReferencedColumnName
        {
            get { return _ReferencedColumnName; }
        }
        #endregion
    }
}
